package com.suixinsanren.design.state.demo.demo06;

public class NoQuarterState implements State {

    private final GumballMachine gumballMachine;

    public NoQuarterState(GumballMachine gumballMachine) {
        this.gumballMachine = gumballMachine;
    }

    @Override
    public void insertQuarter() {
        System.out.println("投币成功");
        gumballMachine.setState(gumballMachine.getHasQuarterState());
    }

    @Override
    public void ejectQuarter() {
        System.out.println("没有投入硬币，无法退还");
    }

    @Override
    public void turnCrank() {
        System.out.println("没有投入硬币，无法开始游戏");
    }

    @Override
    public String toString() {
        return "没有投币";
    }
}
